/*
 * Menu.h
 *
 *  Created on: 23.05.2011
 *      Author: 123
 */

#ifndef MENU_H_
#define MENU_H_
#include "oslib/oslib.h"
#include "sGame.h"
#include <iostream>
using namespace std;
enum {menu=0 ,options ,game};

extern int state;
class sMenu {
	OSL_IMAGE *StartGame[2];
	OSL_IMAGE * BG;
	int Index;
	int state;
	sGame Game;

public:
	sMenu();
	virtual ~sMenu();
	void Draw();
	void Load(){
		Game.Load();
		Index=1;
		state=0;
		BG=oslLoadImageFile((char*)"data/Menu/menusf.png",OSL_IN_RAM, OSL_PF_8888);
		StartGame[0]=oslLoadImageFile((char*)"data/Menu/startgame.png",OSL_IN_RAM, OSL_PF_8888);
		StartGame[1]=oslLoadImageFile((char*)"data/Menu/startgame_on.png",OSL_IN_RAM, OSL_PF_8888);
	//	oslAssert(Tex[j]);





	}
	void State(){
		if(state==menu)
			this->Run();
		else if (state==game)
			Game.Run();
	}


	int Run(){

		Control();
		oslDrawImageXY(BG,0,0);
		oslDrawImageXY((Index==1) ? StartGame[1] : StartGame[0],150,20);

		return 1;
	}
	int Control(){
		if(osl_keys->pressed.up && Index >1)
			Index--;
		if(osl_keys->pressed.down && Index <3)
			Index++;
		if(osl_keys->pressed.cross && Index==1)
			state=game;



		return 1;
	}

};

#endif /* MENU_H_ */
